package com.ljy.my_study.zookeeper使用;

import java.io.IOException;
import java.util.concurrent.CountDownLatch;

import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.ZooDefs.Ids;
import org.apache.zookeeper.ZooKeeper;

/**
 * @author James
 * @date 2018年6月5日
 */
public class MainTest {
	private static CountDownLatch connectedSemaphore = new CountDownLatch(1);

	public static void main(String[] args) throws Exception {
		ZooKeeper zk = new ZooKeeper("192.168.0.102:2181", 5000, new ZooKeeper_create_api_sync_usage());
		connectedSemaphore.await();
		String path1=zk.create("/zk-test","test".getBytes(),Ids.OPEN_ACL_UNSAFE,CreateMode.EPHEMERAL);
		System.out.println("Success create znode:"+path1);
	}
}
